﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace web_mvc.dto
{
    internal class StudentAddress
    {
        /**
         * 这里建立的是一对一模型，
         * StudentAddress 的主键  StudentAddressId 约束于 Student 的主键
         * 必须有 Student 才能有 StudentAddress ，反之则不行
         * 
         * ALTER TABLE [dbo].[StudentAddresses]  WITH CHECK ADD  CONSTRAINT [FK_dbo.StudentAddresses_dbo.Students_StudentAddressId] FOREIGN KEY([StudentAddressId])
            REFERENCES [dbo].[Students] ([StudentID])
         */
        [ForeignKey("Student")]
        public int StudentAddressId { get; set; }

        public string Address1 { get; set; }
        public string Address2 { get; set; }
        public string City { get; set; }
        public int Zipcode { get; set; }
        public string State { get; set; }
        public string Country { get; set; }

        public virtual Student Student { get; set; }
    }
}
